<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<jsp:useBean id="user" class="entity.User" scope="session"/>
<jsp:useBean id="appointments" class="java.util.ArrayList" scope="request"/>

<html>
	<head>
		<title>Recreation Manager - Prethodni Mečevi</title>
		<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="theme.css">
		<script type="text/javascript" src="scripts/linkfader.js"></script>
	</head>
	<c:if test="${user.userId==null}">
		<c:redirect url="./main.jsp" />
	</c:if>
	<body>
	<center>
		<c:import url="./header.jsp"></c:import>
		<table class="mainTable">
			<tr>
				<td width="200px" valign="top">
					<c:import url="./menu.jsp"></c:import>
				</td>			
				<td valign="top">
				<!-- itt kezdodik -->
			<table class="list">
				<thead>
				<tr>
					<th colspan="9"><h2>Prethodni mečevi</h2></th>
				</tr>
					<tr>
						<th>Naziv:</th>
						<th>Rezultat:</th>
						<th>Lokacija:</th>
						<th>Datum:</th>
						<th>Od:</th>
						<th>Do:</th>
						<th>MVP:</th>
						<th>&nbsp;</th>			
						<th>&nbsp;</th>		
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${appointments}" var="app">
						<c:if test="${app.footballMatch!=null}">
							<tr>
								<td>${app.footballMatch.name}</td>
								<td>${app.footballMatch.goalHome}:${app.footballMatch.goalGuest}</td>
								<td>${app.location}</td>
								<td><fmt:formatDate value="${app.date}" pattern="dd.MM.yyyy" /> </td>
								<td><fmt:formatDate value="${app.from}" pattern="HH:mm"/></td>
								<td><fmt:formatDate value="${app.to}" pattern="HH:mm"/></td>
								<td>${app.footballMatch.mvp.firstName} ${app.footballMatch.mvp.lastName}</td>
								<td><a href="PrepareAppointmentView?appId=${app.appointmentId}">Komentari</a></td>
								<td><a href="PrepareMatchDetail?appId=${app.appointmentId}">Detalji</a></td>
							</tr>
						</c:if>
					</c:forEach>
				</tbody>		
			</table>
				<!-- itt vegzodik -->
				</td>
			</tr>
		</table>
	</center>
	</body>	
</html>